package com.yinhaochuan.index;

import java.io.File;
import java.io.IOException;

import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.store.FSDirectory;

public class testIndexer {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws CorruptIndexException 
	 */
	public static void main(String[] args) throws CorruptIndexException, IOException {
		String indexpath = "E:/NTCIR/SEGIndex";
		printNumdocs(indexpath);
	}
	
	public static void printNumdocs(String indexpath){
		IndexReader indexReader = null;
		try {
			indexReader = IndexReader.open(FSDirectory.open(new File(indexpath)));
		} catch (CorruptIndexException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println(indexReader.numDocs());
	}
	
}
